package com.teamfractal.fracdustry.common.item.impl;

import com.teamfractal.fracdustry.common.item.FDConsumableItem;
import net.minecraft.client.Minecraft;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;

import javax.annotation.Nonnull;

public class MagnifierItem extends FDConsumableItem {
    public MagnifierItem(Properties properties) {
        super(properties);
    }

    @Nonnull
    @Override
    public InteractionResultHolder<ItemStack> use(@Nonnull Level level, @Nonnull Player player, @Nonnull InteractionHand hand) {
        InteractionResultHolder<ItemStack> ir = super.use(level,player,hand);
        if (level.isClientSide()){
            Minecraft.getInstance().gameRenderer.displayItemActivation(ir.getObject());
        }
        player.getCooldowns().addCooldown(ir.getObject().getItem(), 60);
        return ir;
    }

    @Override
    public int getUseDuration(@Nonnull ItemStack stack) {
        return 60;
    }


}
